﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ArticleDetail.aspx.vb" Inherits="WeightLossProject.ArticleDetail" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:DetailsView ID="dvArticleDetail" runat="server" AutoGenerateRows="False" 
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataKeyNames="ID" DataSourceID="dsArticleDetail" 
        ForeColor="Black" GridLines="Horizontal" Height="50px" Width="660px">
        <EditRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:TemplateField>
                   <ItemTemplate>
                    <h2 class="custom-header">
                        <%# Eval("Title")%> 
                    </h2>
                   </ItemTemplate>
            
            </asp:TemplateField>
            <asp:TemplateField HeaderText="MetaData:">
                   <ItemTemplate>
                            <strong>Added By <a href="ProfilePage.aspx?UID=<%# Eval("UserID")%>"><%# Eval("Username")%></a> on <%# Eval("DateAdded")%> Under the  <a href="ArticlesByCategory.aspx?CID=<%# Eval("Category")%>"><%# Eval("CategoryName")%></a> Category </strong>
                   </ItemTemplate>
            </asp:TemplateField>
            <asp:ImageField HeaderText="Picture" DataImageUrlField="Picture">
            </asp:ImageField>
            <asp:BoundField DataField="Details" HeaderText="Details" 
                SortExpression="Details" />
        </Fields>
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
    </asp:DetailsView>
    <asp:SqlDataSource ID="dsArticleDetail" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [ArticleCategoryUser] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ID" QueryStringField="AID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <asp:GridView ID="grdComments" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataKeyNames="ID"  
        ForeColor="Black" GridLines="Horizontal">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                ReadOnly="True" SortExpression="ID" />
            <asp:BoundField DataField="AddedBy" HeaderText="AddedBy" 
                SortExpression="AddedBy" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="Details" HeaderText="Details" 
                SortExpression="Details" />
            <asp:BoundField DataField="DateAdded" HeaderText="DateAdded" 
                SortExpression="DateAdded" />
            <asp:BoundField DataField="Progress_FKID" HeaderText="Progress_FKID" 
                SortExpression="Progress_FKID" />
            <asp:BoundField DataField="Article_FKID" HeaderText="Article_FKID" 
                SortExpression="Article_FKID" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
        <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F7F7F7" />
        <SortedAscendingHeaderStyle BackColor="#4B4B4B" />
        <SortedDescendingCellStyle BackColor="#E5E5E5" />
        <SortedDescendingHeaderStyle BackColor="#242121" />
    </asp:GridView>
    <asp:SqlDataSource ID="dsArticleComments" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
        SelectCommand="SELECT * FROM [tblComments] WHERE ([Article_FKID] IS NOT NULL)">
    </asp:SqlDataSource>
    <br />

    <asp:PlaceHolder ID="phCommentBox" runat="server">
    <div id="divAComment" class="commentbox">
      <p><h2 class="custom-header">Add your Comment Here</h2></p>

    <p>
        <asp:Label ID="Label3" runat="server" CssClass="formlabel" Text="Comment Title"></asp:Label>
        <asp:TextBox ID="txtACTitle" runat="server" Height="29px" Width="187px"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvTxtACTitle" runat="server" 
            ControlToValidate="txtACTitle" CssClass="error" Display="Dynamic" 
            ErrorMessage="Comment  Title is Required!"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Label ID="Label2" runat="server" CssClass="formlabel" 
            Text="Comment"></asp:Label>
        <asp:TextBox ID="txtAComment" runat="server" TextMode="MultiLine" Width="194px" 
            Height="134px"></asp:TextBox>
        <asp:RequiredFieldValidator ID="rfvTxtComment" runat="server" 
            ControlToValidate="txtAComment" CssClass="error" Display="Dynamic" 
            ErrorMessage="Comment is Required!"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Button ID="btnAddComment" runat="server" Text="Add Comment!" />
    </p>
    </div>
    
    </asp:PlaceHolder>
    
    <asp:PlaceHolder ID="phLogintoComment" runat="server" >
    <div id="divLogintoComment" class="commentbox">
    <h3><b>Please <a href="Account/Login.aspx">Login</a> First to Post Comments and Ratings!</b></h3>
    </div>
    </asp:PlaceHolder>

    </asp:Content>
